/* Copyright  2009
   @Author
   Richard Changde Yin            e-mail yinchangde@hotmail.com

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; version 2 of the License.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

/**
 * @filename: current_session.cc
 */

#include <server_includes.h>
#include <current_session.h>

#include <pthread.h>


///Note:  Please declare it the main entry file.

extern pthread_key_t THR_Session;
extern pthread_key_t THR_Mem_root;

Session * _current_session(void)
{
  return static_cast<Session *>  (pthread_getspecific(THR_Session));
}


MEM_ROOT * current_mem_root(void)
{
  return *(static_cast<MEM_ROOT **> (pthread_getspecific(THR_Mem_root)));
}


MEM_ROOT **current_mem_root_ptr(void)
{
  return static_cast<MEM_ROOT **>   (pthread_getspecific(THR_Mem_root));
}

